<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>{__('会员中心')}-{$webname}</title>
    {include "pub/varname"}
    {Common::css('user.css,base.css,extend.css,recharge.css')}
    {Common::js('jquery.min.js,base.js,common.js,jquery.validate.js,jquery.cookie.js,ajaxform.js')}
    <link rel="stylesheet" href="/tools/js/datetimepicker/jquery.datetimepicker.css">
    <script src="/tools/js/datetimepicker/jquery.datetimepicker.full.js"></script>
</head>
<body>
{request "pub/header"}
<div class="big">
    <div class="wm-1200">

        <div class="st-guide">
            <a href="{$cmsurl}">{__('首页')}</a>&nbsp;&nbsp;&gt;&nbsp;&nbsp;{__('我的钱包')}
        </div><!--面包屑-->

        <div class="st-main-page">
            {include "member/left_menu"}
            <div class="user-main-box">
                <!-- 会员中心导航 -->
                <div class="user-cont-box">
                    <div class="wallet-recharge-wrap">
                        <div class="wallet-recharge-tit">我要充值</div>
                        <div class="wallet-recharge-content">
                            <ul class="wallet-recharge-list clearfix">
                                {loop $wallet $k $v}
                                <li data-describe="{$v['describe']}" data-id="{$v['id']}" class="wallet-recharge-item {if $k<1}on{/if}">{$v['amount']}元</li>
                                {/loop}
                            </ul>
                            <div class="wallet-recharge-gift" style="height: 21px"></div>
                            <a href="javascript:;" class="wallet-recharge-btn">充值</a>
                        </div>
                    </div>
                    <!-- 充值 -->
                </div>
            </div>
        </div>
    </div>
</div>
{Common::js('layer/layer.js')}
{request "pub/footer"}

<script>
    var describe = '';
    $(function(){
        describe = $('.wallet-recharge-list li.on').attr('data-describe');
        $('.wallet-recharge-gift').show().html(describe);

        $('.wallet-recharge-list li').on('click',function(){
            $(this).addClass('on').siblings().removeClass('on');
            describe = $(this).attr('data-describe');

            if(describe!='充值赠送：'){
                $('.wallet-recharge-gift').show().html(describe);
            }else{
                $('.wallet-recharge-gift').html('');
            }
        });

        $('.wallet-recharge-btn').on('click',function(){
            var id = $('.wallet-recharge-list li.on').attr('data-id');
            layer.confirm('确认充值？', {
                btn: ['确定'], //按钮
                yes: function(){
                    $.ajax({
                        type: "POST",
                        url: "/member/bag/ajax_add_order",
                        data: {id: id},
                        dataType: "json",
                        success: function(data){
                            if(data.status){
                                layer.closeAll();
                                window.location.href = data.url;
                            }else{
                                layer.msg('充值失败');
                            }
                        }
                    })
                }
            });
        })
    })
</script>
<script>
    $(function(){
        //提交申请
        $("#submit_btn").click(function(){
            $("#frm").submit();
        });

        //验证
        $("#frm").validate({
            rules: {
                amount:
                    {
                        required:true,
                        digits:true
                    },
                bankaccountname:
                    {
                        required:true
                    },
                bankcardnumber:
                    {
                        required:true
                    },
                bankname:
                    {
                        required:true
                    }
            },
            messages: {
                amount:
                    {
                        required:'必填',
                        digits:'请填入整数金额'
                    },
                bankaccountname:
                    {
                        required:'必填'
                    },
                bankcardnumber:
                    {
                        required:'必填'
                    },
                bankname:
                    {
                        required:'必填'
                    }
            },
            submitHandler:function(form){
                $.ajaxform({
                    method: "POST",
                    isUpload: true,
                    form: "#frm",
                    dataType: "html",
                    success: function (result) {

                    }
                });
                return false;
            },
            errorClass:'error-txt',
            errorElement:'span'
        });
        //导航选中
        $("#nav_money").addClass('on');

    })
</script>
</body>
</html>
